package cn.jwcat.controller;

import cn.jwcat.entity.File;
import cn.jwcat.service.IFileService;
import io.swagger.annotations.ApiOperation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.io.IOException;

/**
 * 文件操作
 */
@Transactional
@RestController
@RequestMapping("/file")
public class FileController {
	@Resource
	IFileService IFileService;

	@PostMapping("/upload")
	@ApiOperation("文件的上传")
	public File upload(MultipartFile file) throws IOException {
		return IFileService.upload(file);
	}
}
